<?php
namespace support\bootstrap\db;

use support\bootstrap\Log;
use Webman\Bootstrap;
use think\facade\Db;

class Thinkphp implements Bootstrap
{
    // 进程启动时调用
    public static function start($worker)
    {
        Db::setConfig(config('thinkorm'));
//        Db::setCache(Cache::instance());
        if (config("app.debug")) {
            Db::listen(function ($sql, $runtime, $master) {
                Log::info(sprintf('SQL: %s [ RunTime:%f ]', $sql, $runtime));
            });
        }
    }
}